function nImgUPE = clusteringPatchSearching(noisyImage, basicImage, sigma, ...
                                            orgPatchMatchingFileName, ...
                                            outPatchMatchingFileName)
%% Parameters & Initialization
if (sigma>=40); nWien = 12; else nWien = 8; end                % patch size
bdr = 16;                                % image boundary size used in BM3D
sim_ind = load(orgPatchMatchingFileName);  % original similar patch indices

%% Unreliable Pixel Estimation (UPE)
[finalUpeImage, upeBasicImage] = upePipeline(noisyImage, ...
                                             basicImage, ...
                                             sim_ind, ...
                                             bdr, nWien);  
%% Clustering after modification
similarPatchClustering(basicImage, upeBasicImage, ...
                       outPatchMatchingFileName, sim_ind, bdr, nWien);
nImgUPE = finalUpeImage;
return
